package nl.haemers.components.grid 
{
	import flash.geom.Point;
	import flash.geom.Rectangle;
	/**
	 * ...
	 * @author Jonathan Haemers
	 */
	public class GridItem implements IGridItem
	{
		private var _rect					:Rectangle;
		private var _gridId					:uint;
		private var _data					:*;
		private var _gridPosition			:Point;
		
		private var _height					:Number;
		private var _width					:Number;
		
		public function GridItem(data:* = null, width:Number = NaN, height:Number = NaN) 
		{
			_data = data;
			_width = width;
			_height = height;
		}
		
		/** Public methods **/
		public function clone() : IGridItem
		{
			var clone:GridItem = new GridItem(this.data, this.width, this.height);
			if (this.rect)
			{
				clone.rect = this.rect.clone();
			}
			else
			{
				clone.rect = new Rectangle();
			}
			clone.gridId = this.gridId;
			if (this.gridPosition)
			{
				clone.gridPosition = this.gridPosition.clone()
			}
			else
			{
				clone.gridPosition = new Point();
			}
			
			return clone;
		}
		
		/** Getters & Setters **/
		public function get rect() : Rectangle
		{
			return _rect;
		}
		public function set rect(value:Rectangle) : void
		{
			_rect = value;
		}
		
		public function get gridId() : int
		{
			return _gridId;
		}
		public function set gridId(value:int) : void 
		{
			_gridId = value;
		}
		
		public function get data() : *
		{
			return _data;
		}
		public function set data(value:*) : void 
		{
			_data = value;
		}
		
		public function get gridPosition() : Point
		{
			return _gridPosition;
		}
		public function set gridPosition(value:Point) : void 
		{
			_gridPosition = value;
		}
		
		public function get height() : Number
		{
			return _height;
		}
		public function set height(value:Number) : void 
		{
			_height = value;
		}
		
		public function get width() : Number
		{
			return _width;
		}
		public function set width(value:Number) : void 
		{
			_width = value;
		}
	}

}